.right-anchor {
  display: flex;
  flex-direction: column;
  margin: 0;
  max-height: 75vh;
  min-width: 140px;
}

.right-anchor.is-global {
  position: fixed;
  top: var(--navbar-height);
  right: 0;
  z-index: 1;
}

.right-anchor.is-global .right-anchor-menu {
  align-items: center;
}

/* button */

.right-anchor-button {
  position: absolute;
  right: 0.2rem;
  padding: 0.6rem;
  margin: 0.2rem;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--rightAnchorBtnTextColor);
  background-color: var(--rightAnchorBtnBgColor);
  border-radius: 4px;
  cursor: pointer;
}

.right-anchor-button:hover {
  color: var(--c-text-accent);
}

.right-anchor-button svg {
  width: 1.75rem;
  height: 1.75rem;
}

/* menu */

.right-anchor-menu {
  padding: 12px 0 12px 0;
  border-left: 1px solid var(--c-border);
  font-size: var(--rightAnchorFontSize);
  overflow-y: auto;
  max-height: calc(100% - 1.75rem - 0.6rem * 2 + 0.2rem * 2);
  margin: calc(1.75rem + 0.6rem * 2 + 0.2rem * 2) 0 0 0;
  background-color: var(--rightAnchorMenuBgColor);
}

.right-anchor-menu-item {
  display: block;
  padding: 4px 12px 4px 0;
  margin-left: -1px;
  text-decoration: none;
  display: block;
  cursor: pointer;
  color: var(--rightAnchorMenuTextColor);
}

.right-anchor-menu-item:hover, .right-anchor-menu-item.active {
  color: var(--c-text-accent);
  border-left: 2px solid var(--c-text-accent);
  padding-left: 22px;
}

.right-anchor-menu-item.h1 {
  padding-left: 2px;
  font-weight: bold;
  font-size: calc(var(--rightAnchorFontSize) + 2px);
  text-align: center;
}

.right-anchor-menu-item.h1:hover, .right-anchor-menu-item.h1.active {
  padding-left: 0px;
}

.right-anchor-menu-item.h2 {
  padding-left: 16px;
  font-weight: bold;
}

.right-anchor-menu-item.h2:hover, .right-anchor-menu-item.h2.active {
  padding-left: 14px;
}

.right-anchor-menu-item.sub {
  padding-top: 2px;
  padding-bottom: 2px;
}

.right-anchor-menu-item.sub.h3 {
  padding-left: 24px;
}

.right-anchor-menu-item.sub.h3:hover, .right-anchor-menu-item.sub.h3.active {
  padding-left: 22px;
}

.right-anchor-menu-item.sub.h4 {
  padding-left: 32px;
}

.right-anchor-menu-item.sub.h4:hover, .right-anchor-menu-item.sub.h4.active {
  padding-left: 30px;
}

.right-anchor-menu-item.sub.h5 {
  padding-left: 40px;
}

.right-anchor-menu-item.sub.h5:hover, .right-anchor-menu-item.sub.h5.active {
  padding-left: 38px;
}

.right-anchor-menu-item.sub.h6 {
  padding-left: 48px;
}

.right-anchor-menu-item.sub.h6:hover, .right-anchor-menu-item.sub.h6.active {
  padding-left: 46px;
}

@media (max-width: 719px) {
  .right-anchor {
    display: none;
  }
}
